package com.gitee.algorithm.test;
/*

 2.定义测试类Test，在测试类Test中定义测试方法Comparable getMax(Comparable c1,Comparable c2)完成测试

 */

import com.gitee.algorithm.sort.Student;

public class DemoComparable {
    public static void main(String[] args) {
        Student stu1=new Student();
        stu1.setAge(18);
        Student stu2=new Student();
        stu2.setAge(19);
        Comparable result=getMax(stu1,stu2);
        System.out.println(result);
    }
    public static Comparable getMax(Comparable c1,Comparable c2){
        int result=c1.compareTo(c2);
        if (result<0){
            return c2;
        }else {
            return c1;
        }
    }
}
